Merge "TitleInputWidget: Correct links when 'relative' option used"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 16 Jul 2015 22:10:32 +0000 (22:10 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 16 Jul 2015 22:10:32 +0000 (22:10 +0000)
includes/widget/TitleInputWidget.php
resources/src/mediawiki.widgets/mw.widgets.TitleInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js

index e160a23..37c9d9c 100644 (file)
@@ -20,7 +20,7 @@ class TitleInputWidget extends TextInputWidget {
        /**
         * @param array $config Configuration options
         * @param int|null $config['namespace'] Namespace to prepend to queries
-        * @param bool|null $config['relative'] If a namespace is set, return a title relative to it (default; true)
+        * @param bool|null $config['relative'] If a namespace is set, return a title relative to it (default: true)
         */
        public function __construct( array $config = array() ) {
                // Parent constructor
index ca8c400..e715361 100644 (file)
                        data: this.namespace !== null && this.relative
                                ? mwTitle.getRelativeText( this.namespace )
                                : title,
+                       title: mwTitle,
                        imageUrl: this.showImages ? data.imageUrl : null,
                        description: this.showDescriptions ? data.description : null,
                        missing: data.missing,
index 07b81e4..6623aa7 100644 (file)
@@ -14,7 +14,8 @@
         *
         * @constructor
         * @param {Object} [config] Configuration options
-        * @cfg {string} [data] Page title
+        * @cfg {string} [data] Label to display
+        * @cfg {mw.Title} [title] Page title object
         * @cfg {string} [imageUrl] Thumbnail image URL with URL encoding
         * @cfg {string} [description] Page description
         * @cfg {boolean} [missing] Page doesn't exist
@@ -23,7 +24,7 @@
         * @cfg {string} [query] Matching query string
         */
        mw.widgets.TitleOptionWidget = function MwWidgetsTitleOptionWidget( config ) {
-               var icon, title = config.data;
+               var icon;
 
                if ( config.missing ) {
                        icon = 'page-not-found';
@@ -38,8 +39,8 @@
                // Config initialization
                config = $.extend( {
                        icon: icon,
-                       label: title,
-                       href: mw.util.getUrl( title ),
+                       label: config.data,
+                       href: config.title.getUrl(),
                        autoFitLabel: false
                }, config );